﻿@namespace BulmaRazor.Components
@inherits BulmaComponentBase


@if (hasHref)
{
    <a @attributes="Attributes" class="@clesses">
        @ChildContent
    </a>
}
else
{
    <p @attributes="Attributes" class="@clesses">
        @ChildContent
    </p>
}

@code {

    string clesses => CssBuilder.Default("card-footer-item")
        .AddClassFromAttributes(Attributes)
        .Build();

    private bool hasHref;
    
    /// <summary>
    /// 子内容
    /// </summary>
    [Parameter]
    public RenderFragment ChildContent { get; set; }

    
    /// <summary>
    /// 设置参数
    /// </summary>
    /// <param name="parameters"></param>
    /// <returns></returns>
    public override async Task SetParametersAsync(ParameterView parameters)
    {
        await base.SetParametersAsync(parameters);
        hasHref = Attributes.ContainsKey("href");
    }

}